package cn.teaseed.comn;

import cn.hutool.core.date.DateUtil;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.scene.control.CheckBox;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.text.Text;
import lombok.Data;

@Data
public class JobEntity {

    private Long id;
    private StringProperty listener;
    private String listenerPort;
    private StringProperty jobMethod;
    private StringProperty callback;
    private String callBackPort;
    private StringProperty remark;
    //----------DG-LAB ↓----------
    private String waveA;
    private String waveB;
    private String waveATime;
    private String waveBTime;
    private String waveAStrength;
    private String waveBStrength;
    private Boolean relativeStrength;
    private String maxListenerValue;
    //----------Http ↓----------
    private Boolean httpDataJp;
    private String httpDataJpText;
    private Boolean httpDataFormat;
    private String httpDataFormatText;
    private String pollTime;

    public StringProperty remarkProperty() {
        return remark;
    }

    public JobEntity(String listener, String jobMethod, String callback, String remark) {
        this.id = DateUtil.date().getTime();
        this.listener = new SimpleStringProperty(listener);
        this.jobMethod = new SimpleStringProperty(jobMethod);
        this.callback = new SimpleStringProperty(callback);
        this.remark = new SimpleStringProperty(remark);
    }

    public JobEntity(String listener,
                     String listenerPort,
                     String jobMethod,
                     String callback,
                     String callBackPort,
                     String remark,
                     String waveA,
                     String waveB,
                     String waveATime,
                     String waveBTime,
                     String waveAStrength,
                     String waveBStrength,
                     Boolean relativeStrength,
                     String maxListenerValue) {
        this.listenerPort = listenerPort;
        this.callBackPort = callBackPort;
        this.id = DateUtil.date().getTime();
        this.listener = new SimpleStringProperty(listener);
        this.jobMethod = new SimpleStringProperty(jobMethod);
        this.callback = new SimpleStringProperty(callback);
        this.remark = new SimpleStringProperty(remark);
        this.waveA = waveA;
        this.waveB = waveB;
        this.waveATime = waveATime;
        this.waveBTime = waveBTime;
        this.waveAStrength = waveAStrength;
        this.waveBStrength = waveBStrength;
        this.relativeStrength = relativeStrength;
        this.maxListenerValue = maxListenerValue;
    }

    public JobEntity() {
        this.id = DateUtil.date().getTime();
    }

    public JobEntity(String listener,
                     String listenerPort,
                     String jobMethod,
                     String callback,
                     String callBackPort,
                     String remark,
                     Boolean httpDataJp,
                     String httpDataJpText,
                     Boolean httpDataFormat,
                     String httpDataFormatText,
                     String pollTime) {
        this.listenerPort = listenerPort;
        this.callBackPort = callBackPort;
        this.id = DateUtil.date().getTime();
        this.listener = new SimpleStringProperty(listener);
        this.jobMethod = new SimpleStringProperty(jobMethod);
        this.callback = new SimpleStringProperty(callback);
        this.remark = new SimpleStringProperty(remark);
        this.httpDataJp = httpDataJp;
        this.httpDataJpText = httpDataJpText;
        this.httpDataFormat = httpDataFormat;
        this.httpDataFormatText = httpDataFormatText;
        this.pollTime = pollTime;
    }

    public StringProperty listenerProperty() {
        return listener;
    }

    public StringProperty jobMethodProperty() {
        return jobMethod;
    }

    public StringProperty callbackProperty() {
        return callback;
    }

    public void setListener(String listener) {
        this.listener = new SimpleStringProperty(listener);
    }

    public void setJobMethod(String jobMethod) {
        this.jobMethod = new SimpleStringProperty(jobMethod);
    }

    public void setCallback(String callback) {
        this.callback = new SimpleStringProperty(callback);
    }

    public void setRemark(String remark) {
        this.remark = new SimpleStringProperty(remark);
    }

    public String getListener() {
        return listener.get();
    }

    public String getJobMethod() {
        return jobMethod.get();
    }

    public String getCallback() {
        return callback.get();
    }

    public String getRemark() {
        return remark.get();
    }
}
